/*
* 收入和支出种类
* vuex store
* */
import {findAllIncomeType, findAllPayoutType} from "@/api/types";

const state={
    incomeTypes:[],
    payoutTypes:[],
}
const actions={
    async incomeTypes(context){
        //发起请求获取incomeType
        const result = await findAllIncomeType();
        context.commit("INCOMETYPES",result)
    },
    async payoutTypes(context){
        //发起请求获取incomeType
        const result = await findAllPayoutType();
        context.commit("PAYOUTTYPES",result)
    }
}
const mutations={
    INCOMETYPES(state,value){
        state.incomeTypes=value;
    },
    PAYOUTTYPES(state,value){
        state.payoutTypes=value;
    }
}
export default{
    state,
    actions,
    mutations
}